<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

require_once '../php_class/LoginManager.php';
require_once '../../html/fb_login.php';

 $lm = new LoginManager();
 $name = htmlspecialchars($_POST['name']);
 $pass = htmlspecialchars($_POST['pass']);
 if($name ===''){
	 header('Location: http://localhost/SocialAlbum/html/login.html?pm=2') ;
	 return;
 }
 else if($pass ===''){
	 header('Location: http://localhost/SocialAlbum/html/login.html?pm=3') ;
	 return;
 }
 $bool =  $lm->loginChecker($name, $pass);
 if($bool == true){
//	 header('Location: http://localhost/SocialAlbum/html/index.php?'.$_SESSION['name']) ;
	 $login = new FacebookLogin();
        $url = $login->getLoginUrl();
		header('Location: '.$url);
 }
 else	 header('Location: http://localhost/SocialAlbum/html/login.html?pm=1') ;
?>
